<template>
  <div>
    <h6>局部组件</h6>
    <h6>{{ title }}</h6>
    <h6>{{ price }}</h6>
    <!--    子传父-->
    <button @click="subFn">按钮</button>
  </div>
</template>

<script>
import eventBus from '../eventbus'

export default {
  name: "PartPanel",
  props: ['title', 'price'],
  methods: {
    subFn() {
      // 子传父  父接收subPrice事件
      this.$emit('subPrice', '$')
      // 非父子组件通信
      eventBus.$emit("send", 1)
    }
  }
}
</script>

<style scoped>

</style>
